package com.bw.goods.mvvm.adpter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bw.goods.R;
import com.youth.banner.adapter.BannerAdapter;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public class HomeTxtBannerAdapter extends BannerAdapter<String, HomeTxtBannerAdapter.HomeTxtBannerViewHolder> {
    public HomeTxtBannerAdapter(List<String> datas) {
        super(datas);
    }

    @Override
    public HomeTxtBannerViewHolder onCreateHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home_txt_banner,parent,false);
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

        itemView.setLayoutParams(layoutParams);
        return new HomeTxtBannerViewHolder(itemView);
    }

    @Override
    public void onBindView(HomeTxtBannerViewHolder holder, String data, int position, int size) {
        holder.txtbanner_item.setText(data);
    }

    public static class HomeTxtBannerViewHolder extends RecyclerView.ViewHolder{
        TextView txtbanner_item;
        public HomeTxtBannerViewHolder(@NonNull @NotNull View itemView) {
            super(itemView);
            txtbanner_item =itemView.findViewById(R.id.txtbanner_item);

        }
    }
}
